import request from '@/utils/request'

// 查询部门列表
export function getDepartmentList() {
  return request({
    url: '/position/getDepartmentList',
    method: 'post',
  })
}

//获取座位用户数据分页
export function getPositionListByPageParam(queryParams){
  return request({
    url: `/position/getPositionListByPageParam`,
    method: 'post',
    params:{
      pageNum:queryParams.pageNum,
      pageSize:queryParams.pageSize,
    }
  })
}

//删除座位信息
export function deletePositionById(positionId){
  return request({
    url: '/position/deletePositionById',
    method: 'post',
    params:{
      positionId: positionId,
    }
  })
}
//更新座位信息
export function updatePositionById(name,id,positionId){
  return request({
    url: '/position/updatePositionById',
    method: 'post',
    params:{
      name:name,
      id:id,
      positionId: positionId,
    }
  })
}
//请求存在用户的信息
export function getUserList(){
  return request({
    url: '/position/getUserList',
    method: 'post',
  })
}



//物联网云平台项目管理模块
//1. 分页查询
export function getListByPage(queryParams){
  return request({
    url: '/project/getListByPage',
    method: 'post',
    params:{
      pageNum:queryParams.pageNum,
      pageSize:queryParams.pageSize,
      projectId:queryParams.projectId,
      projectName:queryParams.projectName,
      userId:queryParams.userId,
      startTime:queryParams.createTime[0],
      endTime:queryParams.createTime[1],
    }
  })
}
//2. 删除单行数据
export function handDelete(projectId){
  return request({
    url: '/project/handDelete',
    method: 'post',
    params:{
      projectId:projectId
    }
  })
}

//3. 修改项目信息
export function sureUpdateMessage(form){
  return request({
    url: '/project/sureUpdateMessage',
    method: 'post',
    params:{
      projectId:form.projectId,
      projectName:form.projectName,
      projectIntroduce:form.projectIntroduce,
    }
  })
}

//4. 新增一个项目
export function sureAddProject(addCondition){
  return request({
    url: '/project/sureAddProject',
    method: 'post',
    params:{
      projectName:addCondition.projectName,
      projectIntroduce:addCondition.projectIntroduce
    }
  })
}


//物联网云平台设备管理模块
//1. 分页查询
export function getListByDevicePage(queryParams){
  return request({
    url: '/device/getListByDevicePage',
    method: 'post',
    params:{
      pageNum:queryParams.pageNum,
      pageSize:queryParams.pageSize,
      deviceId:queryParams.deviceId,
      deviceName:queryParams.deviceName,
      projectId:queryParams.projectId,
      startTime:queryParams.createTime[0],
      endTime:queryParams.createTime[1],
    }
  })
}
//删除设备
export function deleteDeviceById(deviceId){
  return request({
    url: '/device/deleteDeviceById',
    method: 'post',
    params:{
      deviceId: deviceId,
    }
  })
}
//新增设备
export function addDevice(addCondition){
  return request({
    url: '/device/addDevice',
    method: 'post',
    params:{
      deviceName: addCondition.deviceName,
      deviceIntroduce: addCondition.deviceIntroduce,
      projectId:addCondition.projectId
    }
  })
}
//修改设备
export function updateDevice(form){
  return request({
    url: '/device/updateDevice',
    method: 'post',
    params:{
      deviceId: form.deviceId,
      deviceName: form.deviceName,
      deviceIntroduce: form.deviceIntroduce,
      projectId:form.projectId,
    }
  })
}
//获取新增项目下拉列表
export function getDropdownForAddDevice(){
  return request({
    url: '/device/getDropdownForAddDevice',
    method: 'post',
  })
}
//获取修改项目下拉列表
export function getDropdownForUpdateDevice(projectId){
  return request({
    url: '/device/getDropdownForUpdateDevice',
    method: 'post',
    params:{
      projectId:projectId
    }
  })
}
